// --------------------------------------------------
// ArbitraryCoordinates.cs 2001 by Charles Petzold
// --------------------------------------------------
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.Windows.Forms;
class PrintableForm: Form
{

	public PrintableForm()
	{
		Text = "Printable Form";
		BackColor = SystemColors.Window;
		ForeColor = SystemColors.WindowText;
		ResizeRedraw = true;
	}
	protected override void OnPaint(PaintEventArgs pea)
	{
		DoPage(pea.Graphics, ForeColor,
			ClientSize.Width, ClientSize.Height);
	}
	protected override void OnClick(EventArgs ea)
	{
		PrintDocument prndoc = new PrintDocument();
		prndoc.DocumentName = Text;
		prndoc.PrintPage +=
			new PrintPageEventHandler(PrintDocumentOnPrintPage);
		prndoc.Print();
	}
	void PrintDocumentOnPrintPage(object obj, PrintPageEventArgs ppea)
	{
		Graphics grfx = ppea.Graphics;
		SizeF sizef = grfx.VisibleClipBounds.Size;
		DoPage(grfx, Color.Black, (int)sizef.Width, (int)sizef.Height);
	}
	protected virtual void DoPage(Graphics grfx, Color clr, int cx, int
		cy)
	{
		Pen pen = new Pen(clr);
		grfx.DrawLine(pen, 0, 0, cx - 1, cy - 1);
		grfx.DrawLine(pen, cx - 1, 0, 0, cy - 1);
	}
}

class RotatedRectangles: PrintableForm
{
	public  static void Main()
	{
		Application.Run(new RotatedRectangles());
	}
	public RotatedRectangles()
	{
		Text = "Rotated Rectangles";
	}
	protected override void DoPage(Graphics grfx, Color clr, int cx, int
		cy)
	{
		grfx.TranslateTransform(100,100);
		Console.WriteLine(grfx.Transform.Elements[0]+
			grfx.Transform.Elements[1]+
			grfx.Transform.Elements[2]+
			grfx.Transform.Elements[3]+
				grfx.Transform.Elements[4]+
					grfx.Transform.Elements[5]);
//		Pen pen = new Pen(clr);
//		grfx.PageUnit = GraphicsUnit.Pixel;
//		PointF[] aptf = { (PointF) grfx.VisibleClipBounds.Size };
//		grfx.PageUnit = GraphicsUnit.Inch;
//		grfx.PageScale = 0.01f;
//		grfx.TransformPoints(CoordinateSpace.Page,
//			CoordinateSpace.Device, aptf);
//		grfx.TranslateTransform(aptf[0].X / 2, aptf[0].Y / 2);
//		for (int i = 0; i < 36; i++)
//		{
//			grfx.DrawRectangle(pen, 0, 0, 100, 100);
//			grfx.RotateTransform(10);
//		}
	}
}